package jike.demo44;

/**
 * @author oyz
 * @Description 工厂模式demo
 */
public class RuleConfigSource {

    public IRuleConfigParser load(String ruleConfigFilePath) throws Exception {
        String ruleConfigFileExtension = getFileExtension(ruleConfigFilePath);
        IRuleConfigParser parser = RuleConfigParserFactory.createParser(ruleConfigFileExtension);
        if (parser == null) {
            throw new Exception("Rule config file format is not supported: " + ruleConfigFilePath);
        }
        return  parser;
    }

    private String getFileExtension(String ruleConfigFilePath) {
        return "json";
    }




}
